package com.lightdz.tshirtdz.dal.impl;

import com.lightdz.tshirtdz.model.entity.ReceiveAddrEntity;

import com.lightdz.tshirtdz.utils.MybatisDBHelper;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @ Description：${description}
 * @ Author     ：zbl
 * @ Date       ：Created in 16:54 09/08/2018
 * @ Modified By：
 */
@Repository
public class ReceiveAddrDal {

    public boolean addAddr( ReceiveAddrEntity entity){
        //TODO 字段不完整
        return MybatisDBHelper.Add("addAddr",entity)>0;
    }

    public boolean updateAddr( ReceiveAddrEntity entity){
        return MybatisDBHelper.Update("updateAddr",entity)>0;
    }


    public boolean deleteAddr( int addrId){
        return MybatisDBHelper.DeleteById("deleteAddr",addrId)>0;
    }

    public List<ReceiveAddrEntity> getMyAddr(String wxId){
        return (List<ReceiveAddrEntity>)MybatisDBHelper.SelectListById("getMyAddr",wxId);
    }

    public ReceiveAddrEntity getOneAddr(String wxId,long addrId){
        ReceiveAddrEntity entity=new ReceiveAddrEntity();
        entity.setWxid(wxId);
        entity.setTid((int)addrId);
        return (ReceiveAddrEntity)MybatisDBHelper.SelectOne("getOneAddr",entity);
    }
}
